package mia.util;

import org.jasypt.util.password.ConfigurablePasswordEncryptor;

public class DigesterUtil {

	private static ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor();
	
	static
	{
		passwordEncryptor.setAlgorithm("SHA-512");
		passwordEncryptor.setPlainDigest(true);
	}
	
	public static String getDigest(String encrypt)
	{
		return passwordEncryptor.encryptPassword(encrypt);
	}
	
	public static boolean checkPassword(String plainPassword, String encryptedPassword)
	{
		return passwordEncryptor.checkPassword(plainPassword, encryptedPassword);
	}
	
}
